package com.cf.game.group.dao;

import com.cf.crud.mapper.BaseMapper;
import com.cf.game.group.model.Relation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RelationMapper extends BaseMapper<Relation> {

    @Select("select friend from relation where self=#{self}")
    List<Long> selectBySelf(@Param("self") long userId);

    @Select("select * from relation where self=#{self}")
    List<Relation> selectFriendBySelf(@Param("self") long userId);

    @Select("select friend from relation where self=#{self} and friend=#{receiver}")
    Relation selectBySelfAndFriend(@Param("self") long sender, @Param("receiver") long receiver);
}
